package com.goti.nettyClient.nettyClient;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @program: netty_client
 * @package: com.goti.nettyClient.Listener
 * @description: 开启Client
 * @author: goti
 * @create: 2019-12-04 11:59
 */

@Component
public class InitClient  implements ApplicationListener<ApplicationStartedEvent>{

    @Autowired
    private  NettyClient nettyClient;



    @Override
    public void onApplicationEvent(ApplicationStartedEvent applicationStartedEvent) {
        System.out.println("233");
        try {
            nettyClient.init("127.0.0.1",8200);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
